#ifndef __DMAC_EXT_H__
#define __DMAC_EXT_H__
#include "los_typedef.h"

typedef void REG_ISR(int index, unsigned int channel, void *callback_data);
typedef void PERI_REG_ISR(void *callback_data, int return_status);


/*definition for the return value*/
#define HIEDMAC_ERROR_BASE                100
#define DMAC_CHANNEL_INVALID            (HIEDMAC_ERROR_BASE+1)

#define DMAC_TRXFERSIZE_INVALID            (HIEDMAC_ERROR_BASE+2)
#define DMAC_SOURCE_ADDRESS_INVALID        (HIEDMAC_ERROR_BASE+3)
#define DMAC_DESTINATION_ADDRESS_INVALID    (HIEDMAC_ERROR_BASE+4)
#define DMAC_MEMORY_ADDRESS_INVALID        (HIEDMAC_ERROR_BASE+5)
#define DMAC_PERIPHERAL_ID_INVALID        (HIEDMAC_ERROR_BASE+6)
#define DMAC_DIRECTION_ERROR            (HIEDMAC_ERROR_BASE+7)
#define DMAC_TRXFER_ERROR            (HIEDMAC_ERROR_BASE+8)
#define DMAC_LLIHEAD_ERROR            (HIEDMAC_ERROR_BASE+9)
#define DMAC_SWIDTH_ERROR            (HIEDMAC_ERROR_BASE+0xa)
#define DMAC_LLI_ADDRESS_INVALID        (HIEDMAC_ERROR_BASE+0xb)
#define DMAC_TRANS_CONTROL_INVALID        (HIEDMAC_ERROR_BASE+0xc)
#define DMAC_MEMORY_ALLOCATE_ERROR        (HIEDMAC_ERROR_BASE+0xd)
#define DMAC_NOT_FINISHED            (HIEDMAC_ERROR_BASE+0xe)

#define DMAC_TIMEOUT                (HIEDMAC_ERROR_BASE+0xf)
#define DMAC_CHN_SUCCESS            (HIEDMAC_ERROR_BASE+0x10)
#define DMAC_CHN_ERROR                (HIEDMAC_ERROR_BASE+0x11)
#define DMAC_CHN_TIMEOUT            (HIEDMAC_ERROR_BASE+0x12)
#define DMAC_CHN_ALLOCAT            (HIEDMAC_ERROR_BASE+0x13)
#define DMAC_CHN_VACANCY            (HIEDMAC_ERROR_BASE+0x14)

int dmac_m2m_transfer(AARCHPTR source, AARCHPTR dest, unsigned int length);
int do_dma_p2m(AARCHPTR memaddr, unsigned int peri_addr, unsigned int length, PERI_REG_ISR *pisr, void *callback_data);
int do_dma_m2p(AARCHPTR memaddr, unsigned int peri_addr, unsigned int length, PERI_REG_ISR *pisr, void *callback_data);

#endif

